<?xml version="1.0" encoding="UTF-8"?>
<!-- 
 Copyright (C) 2014 - 2018 - Open Source Geospatial Foundation. All rights reserved.
 This code is licensed under the GPL 2.0 license, available at the root
 application directory.
 -->
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
    <bean class="org.geoserver.platform.ModuleStatusImpl">
        <constructor-arg index="0" value="gs-csw-core"/>
        <constructor-arg index="1" value="GeoServer Catalog Service for the Web (CSW) 2.0.2 Core Service"/>
    </bean>

    <bean id="cswServiceLoader" class="org.geoserver.csw.CSWXStreamLoader">
        <constructor-arg ref="resourceLoader"/>
    </bean>
    
    <bean id="cswLegacyServiceLoader" class="org.geoserver.csw.CSWLegacyLoader"/>

    <bean id="cswLogger" class="org.geoserver.ows.util.EMFLogger">
      <constructor-arg type="java.lang.String" value="org.geoserver.wps"/>
    </bean>
    
    <bean id="cswService" class="org.springframework.aop.framework.ProxyFactoryBean">
      <property name="proxyInterfaces">
        <value>org.geoserver.csw.WebCatalogService</value>
      </property>
      <property name="interceptorNames">
        <list>
          <value>cswLogger</value>
          <value>cswServiceInterceptor*</value>
          <value>cswServiceTarget</value>
        </list>
      </property>
    </bean>

    <!-- Service Descriptor(s) -->
    <bean id="cswService-2.0.2" 
        class="org.geoserver.platform.Service">
        <constructor-arg index="0" value="csw" />
        <constructor-arg index="1" ref="cswService" />
        <constructor-arg index="2" value="2.0.2" />
        <constructor-arg index="3">
		  <list>
		    <value>GetCapabilities</value>
		    <value>DescribeRecord</value>
		    <value>GetRecords</value>
            <value>GetRecordById</value>
            <value>GetDomain</value>
            <value>GetRepositoryItem</value>
            <value>Harvest</value>
            <value>Transaction</value>
            <value>DirectDownload</value>
		  </list>
		</constructor-arg>
    </bean>
    
    <!-- CSW Service -->
    <bean id="cswServiceTarget" class="org.geoserver.csw.DefaultWebCatalogService">
        <constructor-arg ref="geoServer" />
    </bean>
    
    
    <!-- KVP parsers -->
    <bean id="cswAcceptFormatsKvpParser" class="org.geoserver.csw.kvp.AcceptFormatsKvpParser"/>
    <bean id="cswAcceptVersionsKvpParser" class="org.geoserver.csw.kvp.AcceptVersionsKvpParser"/>
    <bean id="cswSectionsKvpParser" class="org.geoserver.csw.kvp.SectionsKvpParser"/>
    <bean id="cswTypeNameParser" class="org.geoserver.csw.kvp.TypenamesKvpParser"/>
    <bean id="cswNamespaceParser" class="org.geoserver.ows.kvp.NamespaceKvpParser">
       <constructor-arg value="namespace"/>
    </bean>
    <bean id="cswStartPositionParser" class="org.geoserver.ows.kvp.IntegerKvpParser">
       <constructor-arg value="startPosition"/>
    </bean>
    <bean id="cswMaxRecordsParser" class="org.geoserver.ows.kvp.IntegerKvpParser">
       <constructor-arg value="maxRecords"/>
    </bean>
    <bean id="cswHopCountParser" class="org.geoserver.ows.kvp.IntegerKvpParser">
       <constructor-arg value="hopCount"/>
    </bean>
    <bean id="cswResultTypeParser" class="org.geoserver.ows.kvp.EnumKvpParser">
       <constructor-arg value="resultType"/>
       <constructor-arg value="net.opengis.cat.csw20.ResultType"/>
       <property name="service" value="csw"/>
    </bean>
    <bean id="cswElementSetTypeParser" class="org.geoserver.ows.kvp.EnumKvpParser">
       <constructor-arg value="elementSetName"/>
       <constructor-arg value="net.opengis.cat.csw20.ElementSetType"/>
    </bean>
    <bean id="cswSortByKvpParser" class="org.geoserver.csw.kvp.SortByKvpParser">
       <constructor-arg ref="filterFactory"/>
    </bean>
    
    
    <!-- KVP readers -->
    <bean id="cswGetCapabilitesKvpRequestReader" class="org.geoserver.csw.kvp.GetCapabilitiesKvpRequestReader"/>
    <bean id="cswDescribeRecordKvpRequestReader" class="org.geoserver.csw.kvp.DescribeRecordKvpRequestReader"/>
    <bean id="cswGetDomainKvpRequestReader" class="org.geoserver.csw.kvp.GetDomainKvpRequestReader"/>
    <bean id="cswGetRecordsKvpRequestReader" class="org.geoserver.csw.kvp.GetRecordsKvpRequestReader">
      <constructor-arg ref="entityResolverProvider"/>
    </bean>
    <bean id="cswGetRecordByIdKvpRequestReader" class="org.geoserver.csw.kvp.GetRecordByIdKvpRequestReader"/>
    <bean id="cswGetRepositoryItemKvpRequestReader" class="org.geoserver.csw.kvp.GetRepositoryItemKvpRequestReader">
    	<constructor-arg ref="cswService-2.0.2" />
    </bean>

    <!-- XML Configuration -->
    <bean id="cswXmlConfiguration-2.0.2" class="org.geotools.csw.CSWConfiguration" >
    </bean>

    <!-- XML Readers -->
    <bean id="cswXmlReader-2.0.2"
        class="org.geoserver.csw.xml.v2_0_2.CSWXmlReader" abstract="true">
        <constructor-arg ref="csw" />
        <constructor-arg ref="cswXmlConfiguration-2.0.2" />
    </bean>
    <bean id="cswGetCapabilitiesXmlReader-2.0.2"
        class="org.geoserver.csw.xml.v2_0_2.CSWXmlReader">
        <constructor-arg index="0" value="GetCapabilities" />
        <constructor-arg index="1" value="2.0.2" />
        <constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
        <constructor-arg ref="entityResolverProvider"/>
    </bean>
    <bean id="cswDescribeRecordXmlReader-2.0.2"
        class="org.geoserver.csw.xml.v2_0_2.CSWXmlReader">
        <constructor-arg index="0" value="DescribeRecord" />
        <constructor-arg index="1" value="2.0.2" />
        <constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
        <constructor-arg ref="entityResolverProvider"/>
    </bean>
    <bean id="cswGetDomainXmlReader-2.0.2"
        class="org.geoserver.csw.xml.v2_0_2.CSWXmlReader">
        <constructor-arg index="0" value="GetDomain" />
        <constructor-arg index="1" value="2.0.2" />
        <constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
        <constructor-arg ref="entityResolverProvider"/>
    </bean>
    <bean id="cswGetRecordsXmlReader-2.0.2"
        class="org.geoserver.csw.xml.v2_0_2.CSWRecordingXmlReader">
        <constructor-arg index="0" value="GetRecords" />
        <constructor-arg index="1" value="2.0.2" />
        <constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
        <constructor-arg ref="entityResolverProvider"/>
    </bean>
    <bean id="cswGetRecordByIdXmlReader-2.0.2"
        class="org.geoserver.csw.xml.v2_0_2.CSWRecordingXmlReader">
        <constructor-arg index="0" value="GetRecordById" />
        <constructor-arg index="1" value="2.0.2" />
        <constructor-arg index="2" ref="cswXmlConfiguration-2.0.2" />
        <constructor-arg ref="entityResolverProvider"/>
    </bean>
    
    
    <!-- Responses -->
    <bean id="cswDescribeRecordResponse-2.0.2" class="org.geoserver.csw.response.DescribeRecordResponse">
       <constructor-arg index="0" ref="geoServer"/>
    </bean>
    
	<bean id="cswCapabilitiesResponse-2.0.2" class="org.geoserver.csw.response.CSWObjectEncodingResponse">
      <constructor-arg index="0" ref="gsInternalCatalogStore"/>
      <constructor-arg index="1" value="net.opengis.cat.csw20.CapabilitiesType"/>
      <constructor-arg index="2" value="Capabilities"/>
      <constructor-arg index="3" value="org.geotools.csw.CSWConfiguration"/> 
    </bean>
    
    <bean id="cswDublinCoreResponse-2.0.2" class="org.geoserver.csw.response.CSWRecordsResponse">
      <constructor-arg index="0" ref="geoServer"/>
    </bean>

    <bean id="cswGetDomainResponse-2.0.2" class="org.geoserver.csw.response.CSWGetDomainResponse">
      <constructor-arg index="0" ref="geoServer"/>
    </bean>
    
    <bean id="cswGetRepositoryItemResponse-2.0.2" class="org.geoserver.csw.response.CSWGetRepositoryItemResponse">
      <constructor-arg index="0" ref="geoServer"/>
    </bean>
    
    <!-- SchemaComponent delegates -->
    <bean id="cswRecordSchemaComponentDelegate" class="org.geoserver.csw.response.TemplatedSchemaComponentDelegate">
        <constructor-arg index="0" ref="geoServer"/>
        <constructor-arg index="1" value="http://www.opengis.net/cat/csw/2.0.2"/>
        <constructor-arg index="2" value="Record"/>
        <constructor-arg index="3" value="CSWRecordSchemaComponent.xml"/>
    </bean>   
    
    <!-- The record descriptors -->
    <bean id="cswRecordDescriptor" class="org.geoserver.csw.records.CSWRecordDescriptor"/>
    
    <!-- http url mapping -->
    <bean id="cswURLMapping" 
      class="org.geoserver.ows.OWSHandlerMapping">
      <constructor-arg ref="catalog"/>
      <property name="alwaysUseFullPath" value="true"/>
      <property name="interceptors">
        <list>
          <ref bean="cswCiteComplianceHack"/>
        </list>
      </property>
      <property name="mappings">
        <props>
          <prop key="/csw">dispatcher</prop>
          <prop key="/csw/*">dispatcher</prop>
        </props>
      </property>
    </bean>
    
    <!-- cite compliance hack -->
    <bean id="cswCiteComplianceHack" class="org.geoserver.ows.CiteComplianceHack">
      <constructor-arg ref="geoServer"/>
          <constructor-arg value="org.geoserver.csw.CSWInfo"/>
    </bean>
    
    <!--  Store -->
    <bean id="gsInternalCatalogStore" class="org.geoserver.csw.store.internal.InternalCatalogStore">
      	<constructor-arg ref="geoServer"/>
    </bean>
      
    <!--  factory extension  -->  
	<bean id="cswFactoryExtension" class="org.geoserver.csw.CSWFactoryExtension"/>

    <!--  DirectDownload extensions -->
    <bean id="DownloadLinkHandler" class="org.geoserver.csw.DownloadLinkHandler" />

    <bean id="FeatureCustomizerRecord" class="org.geoserver.csw.store.internal.RecordCustomizer">
        <property name="downloadLinkHandler">
            <ref bean="DownloadLinkHandler" />
        </property>
    </bean>

    <bean id="cswDirectDownloadKvpRequestReader" class="org.geoserver.csw.kvp.DirectDownloadKvpRequestReader" />

    <bean id="zipResponse" class="org.geoserver.csw.response.ZipOutputFormat" />
    
    <bean id="DirectDownloadXStreamInitializer" class="org.geoserver.csw.DirectDownloadSettingsXStreamInitializer" />
 </beans>
